package tianwang.utils.dict;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * 词典中单词词条
 * 
 * 
 */
public class Entry {
	
	/**
	 * 词条的核心词
	 * 
	 * 大小写敏感
	 */
	public static final String CORE_WORD = "coreWord";
	
	private Map<String, String> items;

	public void setItems(Map<String, String> items) {
		this.items = items;
	}

	public String getContent(String itemName) {
		if ( items == null ) return null;
		return items.get(itemName);
	}

	public Collection<String> getContents() {
		if ( items == null ) return null;
		return items.values();
	}

	public Map<String, String> getItems() {
		return items;
	}
	
	public String getCoreWord() {
		return items.get(CORE_WORD);
	}
	
	/**
	 * 得到小写形式的核心单词
	 * 用作词典中的
	 * 
	 * @return
	 */
	public String getLowerCoreWord(){
		return items.get(CORE_WORD).toLowerCase();
	}

	public Set<String> getNames() {
		if ( items == null ) return null;
		return items.keySet();
	}

}
